.class Lcom/waiqin365/lightapp/im/activity/ba;
.super Landroid/content/BroadcastReceiver;


# instance fields
.field final synthetic a:Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;


# direct methods
.method private constructor <init>(Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;)V
    .locals 0

    iput-object p1, p0, Lcom/waiqin365/lightapp/im/activity/ba;->a:Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;

    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;Lcom/waiqin365/lightapp/im/activity/ai;)V
    .locals 0

    invoke-direct {p0, p1}, Lcom/waiqin365/lightapp/im/activity/ba;-><init>(Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;)V

    return-void
.end method


# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 4

    const-string/jumbo v0, "from"

    invoke-virtual {p2, v0}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    const-string/jumbo v1, "msgid"

    invoke-virtual {p2, v1}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v2

    invoke-virtual {v2}, Lcom/hyphenate/chat/EMClient;->chatManager()Lcom/hyphenate/chat/EMChatManager;

    move-result-object v2

    invoke-virtual {v2, v1}, Lcom/hyphenate/chat/EMChatManager;->getMessage(Ljava/lang/String;)Lcom/hyphenate/chat/EMMessage;

    move-result-object v1

    if-nez v1, :cond_1

    :cond_0
    :goto_0
    return-void

    :cond_1
    invoke-virtual {v1}, Lcom/hyphenate/chat/EMMessage;->getChatType()Lcom/hyphenate/chat/EMMessage$ChatType;

    move-result-object v2

    sget-object v3, Lcom/hyphenate/chat/EMMessage$ChatType;->GroupChat:Lcom/hyphenate/chat/EMMessage$ChatType;

    if-ne v2, v3, :cond_2

    invoke-virtual {v1}, Lcom/hyphenate/chat/EMMessage;->getTo()Ljava/lang/String;

    move-result-object v0

    :cond_2
    iget-object v1, p0, Lcom/waiqin365/lightapp/im/activity/ba;->a:Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;

    invoke-static {v1}, Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;->j(Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/activity/ba;->a:Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;

    invoke-static {v0}, Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;->w(Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;)Lcom/waiqin365/lightapp/im/adapter/f;

    move-result-object v0

    invoke-virtual {v0}, Lcom/waiqin365/lightapp/im/adapter/f;->a()V

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/activity/ba;->a:Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;

    invoke-static {v0}, Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;->w(Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;)Lcom/waiqin365/lightapp/im/adapter/f;

    move-result-object v0

    invoke-virtual {v0}, Lcom/waiqin365/lightapp/im/adapter/f;->getCount()I

    move-result v0

    const/4 v1, 0x5

    if-le v0, v1, :cond_3

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/activity/ba;->a:Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;

    iget-object v0, v0, Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;->a:Landroid/widget/ListView;

    invoke-virtual {v0}, Landroid/widget/ListView;->getFirstVisiblePosition()I

    move-result v0

    iget-object v1, p0, Lcom/waiqin365/lightapp/im/activity/ba;->a:Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;

    invoke-static {v1}, Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;->w(Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;)Lcom/waiqin365/lightapp/im/adapter/f;

    move-result-object v1

    invoke-virtual {v1}, Lcom/waiqin365/lightapp/im/adapter/f;->getCount()I

    move-result v1

    add-int/lit8 v1, v1, -0x5

    if-lt v0, v1, :cond_3

    iget-object v0, p0, Lcom/waiqin365/lightapp/im/activity/ba;->a:Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;

    iget-object v0, v0, Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;->a:Landroid/widget/ListView;

    iget-object v1, p0, Lcom/waiqin365/lightapp/im/activity/ba;->a:Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;

    invoke-static {v1}, Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;->w(Lcom/waiqin365/lightapp/im/activity/CustomServiceChatActivity;)Lcom/waiqin365/lightapp/im/adapter/f;

    move-result-object v1

    invoke-virtual {v1}, Lcom/waiqin365/lightapp/im/adapter/f;->getCount()I

    move-result v1

    add-int/lit8 v1, v1, -0x1

    invoke-virtual {v0, v1}, Landroid/widget/ListView;->smoothScrollToPosition(I)V

    :cond_3
    invoke-virtual {p0}, Lcom/waiqin365/lightapp/im/activity/ba;->abortBroadcast()V

    goto :goto_0
.end method
